<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <h2>v-model的修饰符</h2>

    <h4>lazy修饰符</h4>
    <!-- 当输入框改变，并且失去焦点的时候。再把input的内容给到变量 -->
    <input type="text" v-model.lazy="value">
    <p>value: {{ value }}</p>

    <hr>

    <h4>number修饰符</h4>
    <!-- 用来尝试将内容转成数字类型 -->
    <input type="text" v-model.number="value2">
    <p>value2: {{ value2 }}</p>
    <p>value2的数据类型: {{ typeof value2 }}</p>


    <hr>

    <h4>trim修饰符</h4>
    <!-- 用来去除首尾空格 -->
    <input type="text" v-model.trim="value3">
    <p>value3: {{ value3 }}</p>
    <button @click="fn">btn</button>
  </div>


  <script src="../vue3.js"></script>
  <script>
    const {createApp} = Vue;
    const app = createApp({
      data() {
        return {
          value: "abc",
          value2: 1,
          value3: ""
        }
      },
      methods: {
        fn() {
          console.log(this.value3);
          
        }
      }
    }).mount("#app");
  </script>
</body>
</html>